﻿using System;
using System.Collections.Generic;
using System.Text;
using MapReduce;

namespace MapReduceTest
{
       public class WordCountMap : IMap
        {
           public IEnumerable<KeyValuePair<String, String>> Execute(String pKey, String pValue)
           {
               List<KeyValuePair<String, String>> op = new List<KeyValuePair<String, String>>();

               char[] splitChars = { ' ', '\r', '\n', '\t', '\x0085' };
               foreach (string word in pValue.Split(splitChars, StringSplitOptions.RemoveEmptyEntries))
               {
                   op.Add(new KeyValuePair<String, String>(word, "1"));
               }

               return op;

           }
        }//Class WordCountMap
}
/*


        public static IEnumerable<KeyValuePair<String, String>> MyMapMethod(String pKey, String pValue)
        {

            List<KeyValuePair<String, String>> op = new List<KeyValuePair<String, String>>();

            char[] splitChars = { ' ', '\r', '\n', '\t', '\x0085' };
            foreach (string word in pValue.Split(splitChars, StringSplitOptions.RemoveEmptyEntries))
            {
                op.Add(new KeyValuePair<String, String>(word, "1"));
            }
            return op;
        }//MapMethod

*/